package pp.zz.demo;
import org.apache.curator.RetryPolicy;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.framework.recipes.locks.InterProcessLock;
import org.apache.curator.framework.recipes.locks.InterProcessMutex;
import org.apache.curator.retry.ExponentialBackoffRetry;;

import java.util.concurrent.TimeUnit;
public class Ticket12306 implements Runnable {
     private int ticket = 10 ;
     private InterProcessMutex lock ;
     public Ticket12306(){
     RetryPolicy retryPolicy = new ExponentialBackoffRetry(3000, 3);
      CuratorFramework build = CuratorFrameworkFactory.builder().
          connectString("127.168.124.100").sessionTimeoutMs(5000)
          .connectionTimeoutMs(5000).retryPolicy(retryPolicy).build();
        build.start();
        lock = new InterProcessMutex(build,"/lock");
 }

 @Override
 public void run() {

 }

    public static void main(String[] args) {
        System.out.println("2222222222");
    }
}
